package com.example.demo.server;

import com.corundumstudio.socketio.AckRequest;
import com.corundumstudio.socketio.Configuration;
import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;
import com.corundumstudio.socketio.listener.DataListener;
import com.example.demo.config.SocketIOServerConfig;
import com.example.demo.handler.MessageHandler;

public class SocketServer {
    public static void main(String[] args) {

        SocketIOServer server = SocketIOServerConfig.createServer();
        MessageHandler messageHandler = new MessageHandler(server);
        messageHandler.startListening();
        // 启动服务器
        server.start();

        // 等待服务器关闭
        System.out.println("服务器已启动，按任意键停止...");
        try {
            System.in.read();
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 停止服务器
        server.stop();
    }
}
